<?php
/**
 * Created by PhpStorm.
 * User: Xwen
 * Date: 2018/12/9
 * Time: 14:17
 *
 *          ┌─┐       ┌─┐
 *       ┌──┘ ┴───────┘ ┴──┐
 *       │                 │
 *       │       ───       │
 *       │  ─┬┘       └┬─  │
 *       │                 │
 *       │       ─┴─       │
 *       │                 │
 *       └───┐         ┌───┘
 *           │         │
 *           │         │
 *           │         │
 *           │         └──────────────┐
 *           │                        │
 *           │                        ├─┐
 *           │                        ┌─┘
 *           │                        │
 *           └─┐  ┐  ┌───────┬──┐  ┌──┘
 *             │ ─┤ ─┤       │ ─┤ ─┤
 *             └──┴──┘       └──┴──┘
 *                 神兽保佑
 *                 代码无BUG!
 *"The trouble with programmers is that you can never tell what a programmer is doing until it’s too late.”- Seymour Cray
 */

namespace app\lib\exception;


use think\Exception;

class BaseException extends Exception
{
    // HTTP 状态码
    public $httpCode = 400;
    // 错误具体信息
    public $msg = '内部错误';
    // 自定义的错误码
    public $errorCode = 10000;

    public function __construct($params = []){
        if(!is_array($params)){
            return;
        }
        if(array_key_exists('msg', $params)){
            $this->msg = $params['msg'];
        }
        if(array_key_exists('httpCode', $params)){
            $this->httpCode = $params['httpCode'];
        }
        if(array_key_exists('errorCode', $params)){
            $this->errorCode = $params['errorCode'];
        }
    }
}